<template>
    <div>
        <common-header></common-header>
        <main v-if="detail">
            <div class="userdetail">
                <div class="user_con1">
                    <div class="user_img">
                        <img :src="detail.image" alt="">
                        <div class="mb">
                            <img src="/static/images/userprev.png" alt="">
                        </div>
                    </div>
                    <div class="user_info">
                        <div class="user_title">
                            <div class="user_name">
                               {{detail.title}}
                            </div>
                        </div>
                        <div class="item">
                            <div class="i_title">所属支部：</div>
                            <div class="i_value">{{detail.department}}</div>
                        </div>
                        <div class="item">
                            <div class="i_title">所在学院：</div>
                            <div class="i_value">{{detail.college}}</div>
                        </div>
                        <div class="item">
                            <!-- <div class="i_title">入党介绍人:</div> -->
                            <div class="i_value">{{detail.introduce}}</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="con_box">
                <ul class="jd_list" v-if="detail.cpcphase.length>0">
                    <li class="jd_item" v-for="itm in detail.cpcphase" :key="itm.id">
                        <a href="javascript:;">
                            <div class="time_box">
                                <div class="time">{{itm.create_time}}</div>
                                <img src="/static/images/time.png" alt="">
                            </div>
                            <div class="right_info">
                                <div class="name">{{itm.title}}</div>
                                <a :href="'#/result?id='+itm.id+'&name='+detail.title+'&url=#/managedetail?id='+detail.id" style="color:#999">查看详情</a>
                                <div class="txt">
                                    <!-- <span v-html="itm.content"></span> -->
                                </div>
                            </div>
                        </a>
                    </li>
                </ul>
            </div>
        </main>
        <common-footer type="2"></common-footer>
    </div>
</template>
<script>
import CommonHeader from '@/components/commonheader'
import CommonFooter from '@/components/commonfooter'
import CommonBanner from '@/components/commonBanner'
import commonNav from '@/components/commonNav'
import commonUser from '@/components/commonUser'
export default {
    data(){
        return{
            detail:null,
            name:'',
            url:'',
            list:[],
            prev:null,
            next:null,
            detailid:''
        }
    },
    created(){
        this.getdata(this.$route.query.id)
        
    },
    mounted(){
        
    },
    watch:{
        $route:{
            handler(newval,oldval){
                if(newval){
                    this.detailid = newval.query.id
                    this.getdata(newval.query.id)
                }
            },
            deep:true
        }
    },
    methods:{
        getdata(id){
            this.$api.post('getCpcInfo',{
                id:id
            }).then(res=>{
                console.log(res)
                if(res.code === 200){
                    this.detail = res.data.data
                }else{
                    alert(res.message)
                    this.$router.go(-1)
                }
                
            })
        },
    },
    components:{
        CommonBanner,
        CommonFooter,
        CommonHeader,
        commonNav,
        commonUser
    }
}
</script>
<style lang="scss" scoped>
@import  '@/assets/css/common.scss';
.con_box{
    width: 1200px;
    margin: 0 auto;
}
</style>